package com.yxch.admin.controller.video;

import com.yxch.admin.model.video.VideoDTO;
import com.yxch.admin.model.video.VideoVO;
import com.yxch.admin.service.video.VideoService;
import com.yxch.admin.utils.ResultAPI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/yxch/admin/video")
public class VideoController {
    @Autowired
    private VideoService videoService;

    //获取筛选的列表
    @GetMapping
    public ResultAPI getVideoList(VideoDTO videoDTO) {
        return videoService.getVideoList(videoDTO);
    }

    /**
     * 获取视频详情
     * @param resource_id
     * @return
     */
    @GetMapping("/{resource_id}")
    public ResultAPI getVideoById(@PathVariable("resource_id") Integer resource_id) {
        return videoService.getVideoById(resource_id);
    }

    /**
     * 视频更新
     * @param videoVO
     * @return
     */
    @PatchMapping
    public ResultAPI updateVideo(@RequestBody VideoVO videoVO) {
        return videoService.updateVideo(videoVO);
    }
}
